package com.fengye.algorithms.leecode;

/**
 * @Author fengye
 * @Date 2023/4/11 9:25
 **/
public class IsPalindrome09 {
    public static void main(String[] args) {
        System.out.println(new IsPalindrome09().isPalindrome(1));
    }
    public boolean isPalindrome(int x) {
        if(x<0) {
            return false;
        }

        int n = 0;
        int t = x;
        while(t/10 > 0) {
            n = n * 10 +  t % 10;
            t /= 10;
        }
        if(t>0) {
            n = n * 10 + t;
        }

        return n == x;
    }
}
